package com.xishu.entity;

import com.xishu.annotation.dao.DefaultValue;
import com.xishu.annotation.dao.FieldMapping;
import com.xishu.annotation.dao.NotModify;
import com.xishu.annotation.dao.Search;
import com.xishu.annotation.lang.Lang;
import com.xishu.annotation.valid.UniqueName;
import com.xishu.entity.customer.CompanyConfig;
import com.xishu.entity.oplog.OpName;
import com.xishu.entity.plat.UserCompanyMapping;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Transient;
import java.util.List;

@Entity(name = "company")
public class Company extends AbstractEntity implements OpName {
    private static final long serialVersionUID = -7790290596880748716L;

    @Transient
    private String opName;

    @ApiModelProperty(name = "餐厅/公司名")
    @Search(like = true)
    @UniqueName
    @Lang(key = "name")
    private String name;

    @ApiModelProperty(name = "餐厅/公司名")
    @Lang(key = "name")
    private String name_zh;

    @ApiModelProperty(name = "餐厅/公司名")
    @Lang(key = "name")
    private String name_en;

    @NotModify
    @ApiModelProperty(value = "总店餐厅的ID")
    private Long companyId;

    @ApiModelProperty(value = "地址ID")
    @DefaultValue(defaultValue = "")
    private String addressId;

    @ApiModelProperty(value = "地址ID列表")
    @Transient
    @FieldMapping(desField = "addressIdListJson", serialize = true)
    @DefaultValue(defaultValue = "")
    private List<Long> addressIdList;

    @ApiModelProperty(value = "地址ID列表")
    @FieldMapping(desField = "addressIdList", serialize = false, genericType = "java.lang.Long")
    @DefaultValue(defaultValue = "")
    private String addressIdListJson;

    @ApiModelProperty(name = "地址")
    @Search(like = true)
    @DefaultValue(defaultValue = "")
    private String companyAddress;

    @ApiModelProperty(name = "详细地址")
    @Lang(key = "addressDetail")
    @DefaultValue(defaultValue = "")
    private String addressDetail;

    @ApiModelProperty(name = "详细地址——中文")
    @Lang(key = "addressDetail")
    @DefaultValue(defaultValue = "")
    private String addressDetail_zh;

    @ApiModelProperty(name = "详细地址——英文")
    @Lang(key = "addressDetail")
    @DefaultValue(defaultValue = "")
    private String addressDetail_en;

    @Column(length = 2000)
    @ApiModelProperty(value = "餐厅介绍")
    @Lang(key = "companyDescription")
    private String companyDescription;

    @Column(length = 2000)
    @ApiModelProperty(value = "餐厅介绍")
    @Lang(key = "companyDescription")
    private String companyDescription_zh;

    @Column(length = 2000)
    @ApiModelProperty(value = "餐厅介绍")
    @Lang(key = "companyDescription")
    private String companyDescription_en;

    @ApiModelProperty(value = "唯一编码")
    private String code;

    @ApiModelProperty(value = "商家访问地址")
    private String visitAddress;

    @ApiModelProperty(value = "餐厅LOGO")
    private String companyLogo;

    @ApiModelProperty(value = "餐厅图片")
    private String companyImg;

    @ApiModelProperty(value = "商家联系人")
    private String contactUser;

    @ApiModelProperty(value = "商家联系电话1")
    private String phone1;

    @ApiModelProperty(value = "商家联系电话2")
    private String phone2;

    @ApiModelProperty(value = "是否已开通，用于查询")
    private Boolean pass;

    @ApiModelProperty(value = "email是否已经激活过了")
    private Boolean emailValid;

    @ApiModelProperty(value = "邮件地址")
    @UniqueName
    private String email;

    @ApiModelProperty(value = "权限列表，前端接口使用,该字段不使用了，统一到账号下面")
    @Column(length = 2048)
    @FieldMapping(desField = "privilegeList", serialize = false, genericType = "java.lang.String")
    @Deprecated
    private String privilegeJson;

    @Transient
    @ApiModelProperty(value = "权限列表，前端接口使用,该字段不使用了，统一到账号下面")
    @FieldMapping(desField = "privilegeJson", serialize = true)
    @Deprecated
    private List<String> privilegeList;

    @ApiModelProperty(value = "操作开通或者拒绝的时间")
    private String operatePassTime;

    @Transient
    @ApiModelProperty(value = "同时查询绑定的用户，为true的时候返回")
    private Boolean queryBindUser;

    @ApiModelProperty(value = "同时查询绑定的用户")
    @Transient
    private List<UserCompanyMapping> userCompanyMappingList;

    @ApiModelProperty(value = "商家注册用的语言，好做国际化,中文zh,英文en")
    private String lang;

    @ApiModelProperty(value = "在线触摸屏设备数")
    @NotModify
    private Integer onlineTouchDeviceNumber;

    @ApiModelProperty(value = "允许多少个分店")
    @NotModify
    private Integer shopNumbers;

    @ApiModelProperty(value = "用户数量")
    @NotModify
    private Integer userNumbers;

    @ApiModelProperty(value = "美国版本地址")
    private String usAddress;

    @ApiModelProperty(value = "美国版本城市")
    private String usCity;

    @ApiModelProperty(value = "美国版邮编")
    private String usZip;

    @ApiModelProperty(value = "美国版本州")
    private String usState;

    @ApiModelProperty(value = "是否开启延时打印")
    @NotModify
    @DefaultValue(defaultValue = "false")
    private Boolean printerDelay;

    @ApiModelProperty(value = "分菜分钱的开关")
    @NotModify
    @DefaultValue(defaultValue = "false")
    private Boolean partPay;

    @ApiModelProperty(value = "B端分菜分钱的开关")
    @NotModify
    @DefaultValue(defaultValue = "false")
    private Boolean partPay_b;

    @ApiModelProperty(value = "C端分菜分钱的开关")
    @NotModify
    @DefaultValue(defaultValue = "false")
    private Boolean partPay_c;

    @ApiModelProperty(value = "菜品的高级设置")
    @DefaultValue(defaultValue = "false")
    private Boolean itemAdvancedSetting;

    @Transient
    @FieldMapping(desField = "configJson", serialize = true, isObject = true)
    private CompanyConfig companyConfig;

    @FieldMapping(desField = "companyConfig", serialize = false, genericType = "com.xishu.entity.customer.CompanyConfig", isObject = true)
    @Lob
    @Column(columnDefinition = "MEDIUMTEXT")
    private String configJson;

    @ApiModelProperty(value = "直接开台，不需要选择人数，直接进入下一个界面")
    @DefaultValue(defaultValue = "false")
    private Boolean openTableDirect;

    @ApiModelProperty(value = "自动关闭店铺")
    @DefaultValue(defaultValue = "false")
    private Boolean autoCloseShop;

    @ApiModelProperty(value = "自动关闭店铺时间")
    private String autoCloseShopDate;

    @ApiModelProperty(value = "是否开启更换支付类型")
    @DefaultValue(defaultValue = "false")
    private Boolean whetherOpenPayment;

    @ApiModelProperty(value = "修改打印的公司名")
    private String printCompanyName;

    @ApiModelProperty(value = "是否开启小票最后说明(只有超级管理员能看)")
    @DefaultValue(defaultValue = "false")
    private Boolean openReceiptExplain;

    public Boolean getOpenReceiptExplain() {
        return openReceiptExplain;
    }

    public void setOpenReceiptExplain(Boolean openReceiptExplain) {
        this.openReceiptExplain = openReceiptExplain;
    }

    public String getPrintCompanyName() {
        return printCompanyName;
    }

    public void setPrintCompanyName(String printCompanyName) {
        this.printCompanyName = printCompanyName;
    }

    public Boolean getWhetherOpenPayment() {
        return whetherOpenPayment;
    }

    public void setWhetherOpenPayment(Boolean whetherOpenPayment) {
        this.whetherOpenPayment = whetherOpenPayment;
    }

    public Boolean getAutoCloseShop() {
        return autoCloseShop;
    }

    public void setAutoCloseShop(Boolean autoCloseShop) {
        this.autoCloseShop = autoCloseShop;
    }

    public String getAutoCloseShopDate() {
        return autoCloseShopDate;
    }

    public void setAutoCloseShopDate(String autoCloseShopDate) {
        this.autoCloseShopDate = autoCloseShopDate;
    }

    public Boolean getOpenTableDirect() {
        return openTableDirect;
    }

    public void setOpenTableDirect(Boolean openTableDirect) {
        this.openTableDirect = openTableDirect;
    }

    public Boolean getItemAdvancedSetting() {
        return itemAdvancedSetting;
    }

    public void setItemAdvancedSetting(Boolean itemAdvancedSetting) {
        this.itemAdvancedSetting = itemAdvancedSetting;
    }

    public Boolean getPartPay_b() {
        return partPay_b;
    }

    public void setPartPay_b(Boolean partPay_b) {
        this.partPay_b = partPay_b;
    }

    public Boolean getPartPay_c() {
        return partPay_c;
    }

    public void setPartPay_c(Boolean partPay_c) {
        this.partPay_c = partPay_c;
    }

    public CompanyConfig getCompanyConfig() {
        return companyConfig;
    }

    public void setCompanyConfig(CompanyConfig companyConfig) {
        this.companyConfig = companyConfig;
    }

    public String getConfigJson() {
        return configJson;
    }

    public void setConfigJson(String configJson) {
        this.configJson = configJson;
    }

    public Boolean getPrinterDelay() {
        return printerDelay;
    }

    public void setPrinterDelay(Boolean printerDelay) {
        this.printerDelay = printerDelay;
    }

    public Boolean getPartPay() {
        return partPay;
    }

    public void setPartPay(Boolean partPay) {
        this.partPay = partPay;
    }

    public String getUsAddress() {
        return usAddress;
    }

    public void setUsAddress(String usAddress) {
        this.usAddress = usAddress;
    }

    public String getUsCity() {
        return usCity;
    }

    public void setUsCity(String usCity) {
        this.usCity = usCity;
    }

    public String getUsZip() {
        return usZip;
    }

    public void setUsZip(String usZip) {
        this.usZip = usZip;
    }

    public String getUsState() {
        return usState;
    }

    public void setUsState(String usState) {
        this.usState = usState;
    }

    public Integer getUserNumbers() {
        return userNumbers;
    }

    public void setUserNumbers(Integer userNumbers) {
        this.userNumbers = userNumbers;
    }

    public Integer getShopNumbers() {
        return shopNumbers;
    }

    public void setShopNumbers(Integer shopNumbers) {
        this.shopNumbers = shopNumbers;
    }

    public Integer getOnlineTouchDeviceNumber() {
        return onlineTouchDeviceNumber;
    }

    public void setOnlineTouchDeviceNumber(Integer onlineTouchDeviceNumber) {
        this.onlineTouchDeviceNumber = onlineTouchDeviceNumber;
    }

    public String getLang() {
        return lang;
    }

    public void setLang(String lang) {
        this.lang = lang;
    }

    public String getOperatePassTime() {
        return operatePassTime;
    }

    public void setOperatePassTime(String operatePassTime) {
        this.operatePassTime = operatePassTime;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getContactUser() {
        return contactUser;
    }

    public void setContactUser(String contactUser) {
        this.contactUser = contactUser;
    }

    public String getPhone1() {
        return phone1;
    }

    public void setPhone1(String phone1) {
        this.phone1 = phone1;
    }

    public String getPhone2() {
        return phone2;
    }

    public void setPhone2(String phone2) {
        this.phone2 = phone2;
    }

    public Boolean getPass() {
        return pass;
    }

    public void setPass(Boolean pass) {
        this.pass = pass;
    }

    public Boolean getEmailValid() {
        return emailValid;
    }

    public void setEmailValid(Boolean emailValid) {
        this.emailValid = emailValid;
    }

    public String getCompanyAddress() {
        return companyAddress;
    }

    public void setCompanyAddress(String companyAddress) {
        this.companyAddress = companyAddress;
    }

    public String getCompanyDescription() {
        return companyDescription;
    }

    public void setCompanyDescription(String companyDescription) {
        this.companyDescription = companyDescription;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCompanyLogo() {
        return companyLogo;
    }

    public void setCompanyLogo(String companyLogo) {
        this.companyLogo = companyLogo;
    }

    public String getCompanyImg() {
        return companyImg;
    }

    public void setCompanyImg(String companyImg) {
        this.companyImg = companyImg;
    }

    public String getName() {
        return name;
    }

    @Override
    public String opType() {
        return "餐厅公司";
    }

    @Override
    public String[] fieldName() {
        return new String[]{"name"};
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPrivilegeJson() {
        return privilegeJson;
    }

    public void setPrivilegeJson(String privilegeJson) {
        this.privilegeJson = privilegeJson;
    }

    public List<String> getPrivilegeList() {
        return privilegeList;
    }

    public void setPrivilegeList(List<String> privilegeList) {
        this.privilegeList = privilegeList;
    }

    public String getVisitAddress() {
        return visitAddress;
    }

    public void setVisitAddress(String visitAddress) {
        this.visitAddress = visitAddress;
    }

    public Boolean getQueryBindUser() {
        return queryBindUser;
    }

    public void setQueryBindUser(Boolean queryBindUser) {
        this.queryBindUser = queryBindUser;
    }

    public List<UserCompanyMapping> getUserCompanyMappingList() {
        return userCompanyMappingList;
    }

    public void setUserCompanyMappingList(List<UserCompanyMapping> userCompanyMappingList) {
        this.userCompanyMappingList = userCompanyMappingList;
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public String getAddressId() {
        return addressId;
    }

    public void setAddressId(String addressId) {
        this.addressId = addressId;
    }

    @Override
    public String getOpName() {
        return opName;
    }

    @Override
    public void setOpName(String opName) {
        this.opName = opName;
    }

    public String getAddressDetail() {
        return addressDetail;
    }

    public void setAddressDetail(String addressDetail) {
        this.addressDetail = addressDetail;
    }

    public List<Long> getAddressIdList() {
        return addressIdList;
    }

    public void setAddressIdList(List<Long> addressIdList) {
        this.addressIdList = addressIdList;
    }

    public String getAddressIdListJson() {
        return addressIdListJson;
    }

    public void setAddressIdListJson(String addressIdListJson) {
        this.addressIdListJson = addressIdListJson;
    }

    public String getAddressDetail_zh() {
        return addressDetail_zh;
    }

    public void setAddressDetail_zh(String addressDetail_zh) {
        this.addressDetail_zh = addressDetail_zh;
    }

    public String getAddressDetail_en() {
        return addressDetail_en;
    }

    public void setAddressDetail_en(String addressDetail_en) {
        this.addressDetail_en = addressDetail_en;
    }

    public String getCompanyDescription_zh() {
        return companyDescription_zh;
    }

    public void setCompanyDescription_zh(String companyDescription_zh) {
        this.companyDescription_zh = companyDescription_zh;
    }

    public String getCompanyDescription_en() {
        return companyDescription_en;
    }

    public void setCompanyDescription_en(String companyDescription_en) {
        this.companyDescription_en = companyDescription_en;
    }

    public String getName_zh() {
        return name_zh;
    }

    public void setName_zh(String name_zh) {
        this.name_zh = name_zh;
    }

    public String getName_en() {
        return name_en;
    }

    public void setName_en(String name_en) {
        this.name_en = name_en;
    }
}
